package net.zjitc.interfaces.transport;

/**
 * @Author admin
 * @Date 2019/3/26 14:31
 * 快递任务：单号、货物重量
 */
public class Express {
    String number;
    double weight;

    /**
     * 发货前方法
     */
    public void sendBefore(){
        System.out.println("订单开始处理。。。");
        System.out.println("快递单号"+number);
        System.out.println("货物重量"+weight);
    }
    /**
     * 发货方法
     * @param car
     */
    public void send(Car car){
        System.out.println("运货人"+car.getDriver()+
                "正驾驶编号为"+car.getNumber()+
                "的"+car.getType()+"发送货物");
        car.transport();
    }
    /**
     * 发货后 方法
     * @param car
     */
    public void sendAfter(Car car){
        System.out.println("货物运输完成");
        System.out.println(car.getDriver()+"已将编号为"+car.getNumber()
        +"的"+car.getType()+"归还");
        /* 想要用子类新增的方法时，需要用到多态的转型*/
        Truck truck= (Truck) car;
        truck.keep();
    }
    public Express() {
    }

    public Express(String number, double weight) {
        this.number = number;
        this.weight = weight;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }
}
